package com.hgk.common.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;

import width.hgk.wanwan.R;

/**
 * Created by lenovo on 2016/9/22.
 */
public class MyBaseFragment extends Fragment {
    private Button btn_left,btn_right;
    private TextView tv_title;

    public MyBaseFragment() {

    }
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view = inflater.inflate(R.layout.fragment_where_now, container, false);
        intiView(view);
        return  view;
    }
    @Nullable
    @Override
    public View getView() {

        return super.getView();
    }

    private void intiView(View view) {
        btn_left = (Button) view.findViewById(R.id.btn_left_header);
        btn_right = (Button) view.findViewById(R.id.btn_right_header);
        tv_title = (TextView) view.findViewById(R.id.tv_wherefrag_title);
    }
    //设置按钮文本
    public void setBtnRightText(String str){
        if (btn_right!=null){
            btn_right.setText(str);
        }
    }
    public void setBtnLeftText(String str){
        if (btn_right!=null){
            btn_right.setText(str);
        }
    }
    //设置标题背景
    public void setTvTitleBackground(int resId) {
        if (tv_title != null) {
            tv_title.setText(resId);
        }
    }

    //设置标题文本
    public void setTitleText(String str){
        if (tv_title!=null){
            tv_title.setText(str);
        }
    }

}
